<?
class App_customerModel extends AppModel {
    protected $tableName='customer';
    protected $_map=array(//字符映射
        'customer_id'=>'id',
//        'device_id'=>'loginapp',
        'group'=>'groupname',
        'name'=>'contacts',
        'company'=>'title',
        'phone'=>'tel'
    );
    //获取全部客户  //获取单个客户
    public function customer($map,$type){
        if($type=='0'){//全部
            $check=D('customer')->alias('c')->where($map)->field('c.id,c.title,c.contacts,c.tel,c.weixin,c.address,c.qq,c.email,c.remark')->select();
        }elseif($type='1'){//单个
            $check=D('customer')->alias('c')->where($map)->field('c.id,c.title,c.contacts,c.tel,c.weixin,c.address,c.qq,c.email,c.remark')->find();
        }
        $data = $check?$this->parseFieldsMap($check):'';
        return $data;
    }

}